import { app, Menu, shell, Tray } from 'electron'
const path = require('path')
const createTray = () => {
  const tray = new Tray(
    path.resolve(
      __dirname,
      process.platform == 'darwin' ? '../../resources/macTray@2x.png' : '../../resources/windowTray.png',
    ),
  )
  const contextMenu = Menu.buildFromTemplate([
    {
      label: '退出程序',
      click: () => {
        app.quit()
      },
    },
    {
      label: '公司官网',
      click: () => {
        shell.openExternal('https://www.zqcdd.com')
      },
    },
  ])
  tray.setToolTip('财务桌面端')
  tray.setContextMenu(contextMenu)
}

export { createTray }
